package com.booksystem.campuslibrarymanagementsystem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.booksystem.campuslibrarymanagementsystem.commen.request.userquest.BookBorrowrequst.Approval;
import com.booksystem.campuslibrarymanagementsystem.commen.request.userquest.Renewalapprovalrequest.Renewalapproval;
import com.booksystem.campuslibrarymanagementsystem.commen.result.userresuilt.RenewalTable;
import com.booksystem.campuslibrarymanagementsystem.entity.RenewalapprovalTable;
import com.booksystem.campuslibrarymanagementsystem.entity.ReservationTable;
import com.booksystem.campuslibrarymanagementsystem.mapper.RenewalapprovalTableMapper;
import com.booksystem.campuslibrarymanagementsystem.service.RenewalapprovalTableService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

@Service
public class RenewalapprovalTableServiceImpl extends ServiceImpl<RenewalapprovalTableMapper, RenewalapprovalTable> implements RenewalapprovalTableService {
    @Autowired
    RenewalapprovalTableMapper renewalapprovalTableMapper;

    @Override
    public  int add(RenewalapprovalTable hh){
        return renewalapprovalTableMapper.add(hh);
    }

    @Override
    public List<RenewalTable> liststatus(String account, String approvalstate ){
        return renewalapprovalTableMapper.liststatus(account,approvalstate);
    }

    @Override
    public  List<RenewalapprovalTable>  existsByAccountAndBookidi(String account, int bookid){
        return renewalapprovalTableMapper.existsByAccountAndBookidi(account,bookid);
    }
    @Override
    public   List<RenewalTable> selectByaccount(@Param("account") String account){
        return renewalapprovalTableMapper.selectByaccount(account);
    }

    @Override
    public  int deleteByAccountAndBookid(@Param("account") String account, @Param("approvalid") int approvalid){
        return renewalapprovalTableMapper.deleteByAccountAndBookid(account,approvalid);
    }
    @Override
    public List<RenewalapprovalTable> queryByAccount(String account) {
        return renewalapprovalTableMapper.queryByAccount(account);
    }
    @Override
    public void unapproval(String account, LocalDate approvalTime, String bookid, String Approvalstate) {
        renewalapprovalTableMapper.unapproval(account,approvalTime,bookid,Approvalstate);
    }

    @Override
    public void onapproval(String account, LocalDate approvalTime, String bookid, String Approvalstate) {
        renewalapprovalTableMapper.onapproval(account,approvalTime,bookid,Approvalstate);
    }

    @Override
    public List<RenewalapprovalTable> querydislist(String approvalstate) {
        return renewalapprovalTableMapper.querydislist(approvalstate);
    }
}
